package com.dfbz.homework4;

import org.junit.Test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

public class main {
    @Test
    public void testShowStr() throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        //获取show类的字节码对象。
        Class<ShowStr> showStrClass = ShowStr.class;
        Constructor<ShowStr> showStrConstructor = showStrClass.getConstructor(String.class);
        ShowStr str = showStrConstructor.newInstance("张三");
        str.show();
    }
}
